﻿// <copyright file="PersistenceException.cs" company="Ecole Normale Supérieure">
// Released under GPLv2
// </copyright>
// <summary>Contains the persistence exception base class</summary>

namespace Sqwarea.Persistence.Exceptions
{
    using System;
    using System.Runtime.Serialization;
    using System.Security.Permissions;

    /// <summary>
    /// Persistence exception base class : all persistence exception must inherit from this one
    /// </summary>
    [Serializable]
    public class PersistenceException : Exception
    {
        /// <summary>
        /// Initializes a new instance of the PersistenceException class
        /// </summary>
        /// <param name="message">Exception message</param>
        public PersistenceException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the PersistenceException class
        /// </summary>
        public PersistenceException()
        {
        }

        /// <summary>
        /// Initializes a new instance of the PersistenceException class
        /// </summary>
        /// <param name="message">Exception message</param>
        /// <param name="ex">Parent exception</param>
        public PersistenceException(string message, Exception ex)
            : base(message, ex)
        {
        }

        /// <summary>
        /// Initializes a new instance of the PersistenceException class
        /// </summary>
        /// <param name="info">Serialization infos</param>
        /// <param name="context">Streaming context</param>
        protected PersistenceException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        /// <summary>
        /// Gets object data
        /// </summary>
        /// <param name="info">Serialization info</param>
        /// <param name="context">Streaming context</param>
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
        }
    }
}